package com.hr.mes.dto;

public class Result {

    private Integer code=0;

    private String msg="";

    private Object data;

    public static Result fail(Object data){
        return new Result(-1, "", data);
    }

    public static Result fail(String msg){
        return new Result(-1, msg, null);
    }

    public static Result ok(Object data){
        return new Result(data);
    }

    public static Result ok(){
        return new Result();
    }

    public Result() {
    }

    public Result(Object data) {
        this.data = data;
    }

    public Result(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "Result{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
